<template>
  <a-layout-sider width="200" style="background: #fff">
    <a-menu
        v-model:selectedKeys="selectedKeys"
        mode="inline"
        :style="{ height: '100%', borderRight: 0 }"
    >
      <a-menu-item key="/welcome">
        <router-link to="/welcome">
          <HomeOutlined/> &nbsp; 首页
        </router-link>
      </a-menu-item>
      <a-sub-menu key="/member">
        <template #title>
          <span>
            <UserOutlined/> &nbsp;
            会员管理
          </span>
        </template>
        <a-menu-item key="/member/ticket">
          <router-link to="/member/ticket">
            &nbsp; 会员车票
          </router-link>
        </a-menu-item>
      </a-sub-menu>
      <a-sub-menu key="/business">
        <template #title>
          <span>
            <img src="@/assets/svg/business.svg">  &nbsp;
            业务管理
          </span>
        </template>
        <a-menu-item key="/business/confirm-order">
          <router-link to="/business/confirm-order">
            &nbsp; 订单信息
          </router-link>
        </a-menu-item>
        <a-menu-item key="/business/daily-train-ticket">
          <router-link to="/business/daily-train-ticket">
            &nbsp; 余票信息
          </router-link>
        </a-menu-item>
        <a-menu-item key="/business/daily-train">
          <router-link to="/business/daily-train">
            &nbsp; 每日车次管理
          </router-link>
        </a-menu-item>
        <a-menu-item key="/business/daily-train-station">
          <router-link to="/business/daily-train-station">
            &nbsp; 每日停靠站管理
          </router-link>
        </a-menu-item>
        <a-menu-item key="/business/daily-train-carriage">
          <router-link to="/business/daily-train-carriage">
            &nbsp; 每日车厢管理
          </router-link>
        </a-menu-item>
        <a-menu-item key="/business/daily-train-seat">
          <router-link to="/business/daily-train-seat">
            &nbsp; 每日座位管理
          </router-link>
        </a-menu-item>
      </a-sub-menu>
      <a-sub-menu key="/base">
        <template #title>
          <span>
            <img src="@/assets/svg/train.svg">  &nbsp;
            动车管理
          </span>
        </template>
        <a-menu-item key="/base/station">
          <router-link to="/base/station">
            &nbsp; 车站管理
          </router-link>
        </a-menu-item>
        <a-menu-item key="/base/train">
          <router-link to="/base/train">
            &nbsp; 车次管理
          </router-link>
        </a-menu-item>
        <a-menu-item key="/base/train-station">
          <router-link to="/base/train-station">
            &nbsp; 停靠站管理
          </router-link>
        </a-menu-item>
        <a-menu-item key="/base/train-carriage">
          <router-link to="/base/train-carriage">
            &nbsp; 车厢管理
          </router-link>
        </a-menu-item>
        <a-menu-item key="/base/train-seat">
          <router-link to="/base/train-seat">
            &nbsp; 座位管理
          </router-link>
        </a-menu-item>
      </a-sub-menu>
      <a-sub-menu key="batch">
        <template #title>
          <span>
            <ClockCircleOutlined/> &nbsp;
            跑批管理
          </span>
        </template>
        <a-menu-item key="/batch/job">
          <router-link to="/batch/job">
            <MenuUnfoldOutlined/> &nbsp; 任务管理
          </router-link>
        </a-menu-item>
      </a-sub-menu>
      <a-menu-item>
        <a href="https://github.com/yzk0403/train" target="_blank">
          <GithubOutlined/> &nbsp; 源码地址
        </a>
      </a-menu-item>
    </a-menu>
  </a-layout-sider>
</template>

<script setup>
import {ref, watch} from "vue";
import router from "@/router";
import {ClockCircleOutlined, GithubOutlined, HomeOutlined, UserOutlined} from "@ant-design/icons-vue";

const selectedKeys = ref([]);
// 选择菜单跳转
watch(() => router.currentRoute.value.path, (newValue) => {
  console.log('watch', newValue);
  selectedKeys.value = [];
  selectedKeys.value.push(newValue);
}, {immediate: true});
</script>


<style scoped>

</style>
